s(k,n){if(k==1)return n*(n+1)/2;int r,i;for(i=1,r=0;i<=n;i++)r+=s(k-1,i);return r;}main(k,n){for(gets(&n);~scanf("%d%d",&k,&n);printf("%d\n",s(k,n)));}
